#include "stdafx.h"
#include "ckDataset.h"
#include "ckEnumDataset.h"

namespace ck
{
	namespace data
	{
		EnumDataset::EnumDataset()
		{
			m_iter = m_datasets.begin();
		}


		EnumDataset::~EnumDataset()
		{
			Cleanup();
		}

		void EnumDataset::Add(Dataset* pCase)
		{
			if (pCase)
			{
				m_datasets.push_back(pCase);
			}
		}

		void EnumDataset::Cleanup()
		{
			std::vector<Dataset*>::iterator iter;
			for (iter = m_datasets.begin(); iter != m_datasets.end(); iter++)
			{
				(*iter)->Release();
			}
			m_datasets.clear();
		}

		void EnumDataset::Reset()
		{
			m_iter = m_datasets.begin();
		}

		Dataset* EnumDataset::Next()
		{
			if (m_iter == m_datasets.end())
			{
				return NULL;
			}
			return *(m_iter++);
		}

	}
}
